<?php
namespace Api\Controller;
use Think\Controller;
class OrderController extends CommonController {
    public function index(){
        $map = array();
        $map['wid'] = session('wid');
        $map['is_pay'] = 1;
        if($_GET['openid']){
            $map['openid'] = $_GET['openid'];
        }
        if($_GET['shop_id']){
            $map['shop_id'] = $_GET['shop_id'];
        }
        if($_GET['type']){
            $map['type'] = $_GET['type'];
        }
        $list = M("Order")->where($map)->order("last_time desc")->select();
        $this->ajaxReturn($list);
    }

    public function item(){
        $map['out_trade_no'] = I('id');
        $map['wid'] = session('wid');
        $map['is_pay'] = array('gt', 0);

        $info = M("Order")->where($map)->find();
        $this->ajaxReturn($info);
    }
}